package com.project.smarthome.common.widget.dialog;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.PaintFlagsDrawFilter;
import android.graphics.Path;
import android.graphics.Path.Direction;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.view.View;

public class FFView extends View {
    private Drawable b;
    private Drawable c;
    private PaintFlagsDrawFilter d = new PaintFlagsDrawFilter(1, 2);
    Path path;

    public FFView(Context var1) {
        super(var1);

        try {
            this.b = DrawableUtil.a(this.getContext(), "voice_empty");
            this.c = DrawableUtil.a(this.getContext(), "voice_full");
            this.b.setBounds(new Rect(-this.b.getIntrinsicWidth() / 2, -this.b.getIntrinsicHeight() / 2, this.b.getIntrinsicWidth() / 2, this.b.getIntrinsicHeight() / 2));
            this.c.setBounds(new Rect(-this.c.getIntrinsicWidth() / 2, -this.c.getIntrinsicHeight() / 2, this.c.getIntrinsicWidth() / 2, this.c.getIntrinsicHeight() / 2));
            this.path = new Path();
            this.circleLevel(0);
        } catch (Exception var3) {
        }

    }

    public void circleLevel(int var1) {
        this.path.reset();
        this.path.addCircle(0.0F, 0.0F, (float)(this.b.getIntrinsicWidth() * var1 / 12), Direction.CCW);
    }

    public void onDraw(Canvas var1) {
        var1.save();
        var1.setDrawFilter(this.d);
        var1.translate((float)(this.getWidth() / 2), (float)(this.getHeight() / 2));
        this.b.draw(var1);
        var1.clipPath(this.path);
        this.c.draw(var1);
        var1.restore();
    }

    public void finalize() throws Throwable {
        this.b = null;
        this.c = null;
        super.finalize();
    }

    protected void onMeasure(int var1, int var2) {
        super.onMeasure(var1, var2);
        int var3 = MeasureSpec.getSize(var1);
        int var4 = MeasureSpec.getSize(var2);
        Drawable var5 = this.getBackground();
        if(var5 != null) {
            var3 = var5.getMinimumWidth();
            var4 = var5.getMinimumHeight();
        }

        this.setMeasuredDimension(resolveSize(var3, var1), resolveSize(var4, var2));
    }
}
